<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./js/vue.js"></script>
    <title>Object.defineProperty实操</title>
</head>
<body>
    <div id="root">
        <p>{{name}}</p>
    </div>
    <script>
        const obj = {}
        Object.defineProperty(obj,'name',{
            get(){
                return this.name1
            },
            set(value){
                this.name1 = value
            }
        })

        obj.name = '这是通过set设置的值'
        console.log(obj.name)
        console.log(obj)

        const vm = new Vue({
            data(){
                return {
                    name:'这是自定义属性，查看是通过什么添加'
                }
            }
        }).$mount('#root')

        console.log(vm)
    </script>
</body>
</html>